feat: python native bindings#49
Merged
Merged
Conversation
Remove evaluate_logic as a public method from both WASM exports and Python bindings. The project is focused exclusively on flag evaluation using the stateful update_state + evaluate pattern, not general-purpose JSON Logic evaluation. Changes: - Remove evaluate_logic WASM export function from src/lib.rs - Remove EvaluationResponse struct (no longer needed) - Remove evaluate_logic from Python bindings (python/src/lib.rs) - Update API Reference table in README.md - Update all usage examples (Python, JavaScript, Rust) to use flag evaluation - Remove Python examples that demonstrated evaluate_logic - Remove test_operators.py (tested evaluate_logic) - Update benchmarks to only test FlagEvaluator - Remove PYTHON_TODO.md (all tasks completed) - Clean up unused serde imports This aligns the implementation with the flagd provider specification and reduces API surface area. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
maturin develop requires a virtualenv to be active. Update the test-python CI job to: - Create a virtualenv before running maturin - Activate the virtualenv in each step - Install maturin and pytest into the virtualenv This fixes the error: "Couldn't find a virtualenv or conda environment, but you need one to use this command." 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Update PyO3 from 0.20 to 0.22 to resolve non-local impl definition warnings and ensure compatibility with newer Rust compiler versions. Changes: - Update pyo3 and pythonize dependencies to 0.22 - Update method signatures to use Bound<'_, PyDict> instead of &PyDict - Use .as_any() when calling depythonize (now requires &Bound<PyAny>) - Use PyDict::new_bound() instead of PyDict::new() - Update pymodule signature to use &Bound<PyModule> - Convert pythonize result with .unbind() to match PyObject return type This resolves the compiler warning: "non-local impl definition, impl blocks should be written at the same level as their item" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace manual venv creation and pip with uv, a fast Python package installer and resolver written in Rust. Benefits: - Significantly faster package installation - Built-in caching support - Better dependency resolution - More reliable in CI environments Changes: - Add astral-sh/setup-uv@v4 action - Replace venv + pip with uv venv + uv pip install - Enable uv caching for faster CI runs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive uv documentation for Python bindings development across all documentation files. uv is a fast Python package installer and resolver written in Rust, providing significantly faster package management than traditional pip. Changes: - README.md: Add Development section with uv quick start - python/README.md: Add uv as recommended method with detailed instructions - CLAUDE.md: Update Python bindings section with uv workflow - Update outdated evaluate_logic references in examples Benefits of using uv: - 10-100x faster package installation - Better dependency resolution - Built-in virtualenv management - Seamless drop-in replacement for pip 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add uv.lock file and update workflow to use uv's dependency groups for reproducible, locked dependency installation in CI and local dev. Changes: - Add dependency-groups.dev in pyproject.toml (maturin, pytest) - Generate uv.lock with locked dependency versions - Update CI to use 'uv sync --group dev' instead of 'uv pip install' - Update all documentation to use 'uv sync --group dev' Benefits: - Reproducible builds across environments - Faster CI runs with locked dependencies - Automatic venv creation with 'uv sync' - No manual pip install or venv creation needed The lock file ensures all developers and CI use identical dependency versions, preventing "works on my machine" issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Update CI to use Python 3.9 as the test version. This ensures compatibility with Python 3.9+ as specified in pyproject.toml (requires-python = ">=3.8"). Python 3.9 is a good balance between: - Modern features and performance - Wide compatibility (still supported until Oct 2025) - Common in enterprise environments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Explicitly target Python 3.9-3.13 to avoid compatibility issues with Python 3.14, which is not yet supported by PyO3 0.22. Changes: - Update pyproject.toml: requires-python = ">=3.9,<3.14" - Add Python 3.13 classifier, remove 3.8 - Build wheels for explicit Python versions (3.9, 3.10, 3.11, 3.12, 3.13) - Remove --find-interpreter flag to prevent building for unsupported versions - Update artifact names to include Python version - Regenerate uv.lock with updated constraints This prevents the CI error: "the configured Python interpreter version (3.14) is newer than PyO3's maximum supported version (3.13)" Python 3.9-3.13 provides excellent coverage as: - Python 3.9: EOL October 2025 - Python 3.10: EOL October 2026 - Python 3.11: Current stable - Python 3.12: Latest stable - Python 3.13: Newest release (Oct 2024) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add --interpreter flag to maturin builds to fix aarch64 cross-compilation
failure. Cross-compilation requires explicitly specifying the Python
interpreter since maturin can't auto-detect it for different architectures.
Changes:
- Linux: --interpreter python${{ matrix.python-version }}
- Windows: --interpreter python
- macOS: --interpreter python${{ matrix.python-version }}
This fixes the error:
"Couldn't find any python interpreters. Please specify at least one with -i"
The interpreter is provided by setup-python@v5, which installs the correct
Python version for each matrix combination.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enable PyO3's abi3-py39 feature to build wheels using Python's stable ABI. This allows a single wheel per platform to work across all Python versions 3.9-3.13, dramatically reducing build complexity and CI time. Changes: - Add "abi3-py39" feature to pyo3 dependencies - Remove Python version matrix from wheel builds - Build once per architecture with Python 3.9 (minimum version) - Reduce from 25 builds to 5 builds (5x reduction): • 2 Linux (x86_64, aarch64) • 1 Windows (x64) • 2 macOS (x86_64, aarch64) Benefits: - 80% reduction in CI build time - Simpler wheel naming (no Python version suffix) - Same compatibility (Python 3.9-3.13+) - Standard practice for PyO3 projects - Forward compatible with future Python versions Trade-off: Slight performance cost (~1-2%) from stable ABI, but negligible for most use cases. The stable ABI restricts access to some Python internals but we don't use any restricted APIs. Wheel naming changes: - Before: flagd_evaluator-0.1.0-cp39-cp39-manylinux_2_17_x86_64.whl - After: flagd_evaluator-0.1.0-py39-abi3-manylinux_2_17_x86_64.whl The "abi3" tag indicates forward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
Author
|
relates to #47 |
20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue
Closes #
Type of Change
feat: New feature (minor version bump)fix: Bug fix (patch version bump)docs: Documentation only changeschore: Maintenance tasks, dependency updatesrefactor: Code refactoring without functional changestest: Adding or updating testsci: CI/CD changesperf: Performance improvementsbuild: Build system changesstyle: Code style/formatting changesPR Title Format
IMPORTANT: Since we use squash and merge, your PR title will become the commit message. Please ensure your PR title follows the Conventional Commits format:
Examples:
feat(operators): add new string comparison operatorfix(wasm): correct memory allocation bugdocs: update API examples in READMEchore(deps): update rust dependenciesFor breaking changes, use
!after the type/scope or includeBREAKING CHANGE:in the PR description:feat(api)!: redesign evaluation APITesting
cargo test)cargo fmt)cargo clippy -- -D warnings)Breaking Changes
Additional Notes